<%@page import="model.StudentModel, javax.sql.RowSet" %>

<% response.setContentType("text/html") ; %>
<% 
String username=request.getParameter("username") ;
System.out.println("uname:"+ username);

RowSet crsName = (RowSet) StudentModel.getNameInfo(username);
crsName.next();

RowSet crsCoun = (RowSet) StudentModel.getCounInfo(username);
crsCoun.next();

int resid = crsCoun.getInt("Residence");
int citid = crsCoun.getInt("Citizenship");

RowSet crsResName = (RowSet) StudentModel.getCounName(resid);
crsResName.next();

RowSet crsCitName = (RowSet) StudentModel.getCounName(citid);
crsCitName.next();

RowSet crsAddr = (RowSet) StudentModel.getAddrInfo(username);
crsAddr.next();

RowSet crsSpec = (RowSet) StudentModel.getSpecInfo(username);
crsSpec.next();

RowSet crsRev = (RowSet) StudentModel.getRevInfo(username);
crsRev.next();

RowSet crsDID = (RowSet) StudentModel.getDegreeID(username);
	
%>

	<b>Name:</b> <%=crsName.getString("First")%>
	<span style="padding-left:10px"></span>
<%
	if( !crsName.getString("Middle").equals("") )
	{
%>
		<%=crsName.getString("Middle")%>
		<span style="padding-left:10px"></span>
<% 
	}
%>
	<%=crsName.getString("Last")%><br />
	<b>Country of Residence:</b> <%=crsResName.getString("Country")%><br />
	<b>Country of Citizenship:</b> <%=crsCitName.getString("Country")%><br />
	<b>Address:</b> <br>
	<span style="padding-left:10px"></span>
<%
	if( crsResName.getString("Country").equals("United States") )
	{
%>
	  <b>Street:</b> <%=crsAddr.getString("Street")%><br />
	  <span style="padding-left:10px"></span>
	  <b>City:</b> <%=crsAddr.getString("City")%>
	  <span style="padding-left:10px"></span>
	  <b>State:</b><%=crsAddr.getString("State")%>
	  <span style="padding-left:10px"></span>
	  <b>Zip Code:</b><%=crsAddr.getString("Zip")%><br />
	  <span style="padding-left:10px"></span>
	  <b>Area Code:</b><%=crsAddr.getString("AreaCode")%>
	  <span style="padding-left:10px"></span>
	  <b>Phone:</b> <%=crsAddr.getString("Phone")%><br />
<%
	}
	else
	{
%>
	  <b>Street:</b> <%=crsAddr.getString("Street")%><br />
	  <span style="padding-left:10px"></span>
	  <b>City:</b> <%=crsAddr.getString("City")%><br />
	  <span style="padding-left:10px"></span>
	  <b>Country Telephone Code:</b><%=crsAddr.getString("AreaCode")%>
	  <span style="padding-left:10px"></span>
	  <b>Phone:</b> <%=crsAddr.getString("Phone")%><br />
<%
	}
%>
		<br><b>Degrees</b>
<% 
	//degreepart
	while(crsDID.next()){
		RowSet crsDEG = (RowSet) StudentModel.getDegrees(crsDID.getInt("DegID"));
		while (crsDEG.next()){
			RowSet crsSCH = (RowSet) StudentModel.getSchool(crsDEG.getInt("School"));
			crsSCH.next();
			RowSet crsMAJ = (RowSet) StudentModel.getMajor(crsDEG.getInt("Major"));	
			crsMAJ.next();
%>
		<p><b>Location:</b> <%=crsSCH.getString("Location") %></p>
		<p><b>School:</b> <%=crsSCH.getString("University") %></p>
		<p><b>Discipline of degree:</b> <%=crsMAJ.getString("Discipline") %>
								 <%=crsDEG.getString("Title") %></p>
		<p><b>Degree earned in:</b> <%=crsDEG.getString("Month") %>
							 <%=crsDEG.getString("Year") %></p>
		<p><b>GPA: </b><%=crsDEG.getString("GPA") %></p>
		<p><b>Transcript: </b><%=crsDEG.getString("Trans_name") %></p>
<%
		}
	}
%>
	<b>Specialization:</b> <%=crsSpec.getString("Specialization")%><br />
	<b>Grade1:</b> <%=crsRev.getInt("Grade1")%><br />
<%
	if( crsRev.getString("Comment1") != null )
	{
%>
	<b>Comment1:</b> <%=crsRev.getString("Comment1")%><br />
<%
	}
%>
	<b>Grade2:</b> <%=crsRev.getInt("Grade2")%><br />
<%
	if( crsRev.getString("Comment2") != null )
	{
%>
	<b>Comment2:</b><%=crsRev.getString("Comment2")%><br />
<%
	}
%>
	<b>Grade3:</b> <%=crsRev.getInt("Grade3")%><br />
<%
	if( crsRev.getString("Comment3") != null )
	{
%>
	<b>Comment3:</b> <%=crsRev.getString("Comment3")%><br />
<%
	}
%>



